package com.jjty.dataGenerator.sxhcampus.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jjty.dataGenerator.sxhcampus.mapper.SxActiveTemplateMapper;
import com.jjty.dataGenerator.sxhcampus.service.ISxActiveTemplateService;
import com.jjty.dataGenerator.sxhcampus.vo.SxActiveTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author huangyulong
 * @since 2024-09-03
 */
@Service
public class SxActiveTemplateServiceImpl extends ServiceImpl<SxActiveTemplateMapper, SxActiveTemplate> implements ISxActiveTemplateService {

    @Override
    public SxActiveTemplate getByImei(String imei) {
        SxActiveTemplate template = null;
        try{
            template = this.lambdaQuery().eq(SxActiveTemplate::getImei,imei).one();
        }catch (Exception e){
            List<SxActiveTemplate> list = this.lambdaQuery().eq(SxActiveTemplate::getImei, imei).list();
            template = list.get(0);
        }
        return template;
    }
}
